package com.example.rabbitmqspringboot.demos.web.listener;

import com.example.rabbitmqspringboot.demos.web.pojo.Stud;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @ClassName: OrderMsgConsumer
 * @Description:
 * @Date 2024/04/10 16:52
 * @Author songshaoqiu
 **/
@Component
@Slf4j
public class OrderMsgConsumer {

    @RabbitListener(queues = {"order.release.order.queue"})
    public void listenMsg(Message message, Channel channel, Stud stud) throws IOException {
        System.out.println("接收到消息"+stud);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);

    }
}
